<?php

class Crud_Form_Element_Column_ForeignKey extends Crud_Form_Element_Column
{
	public function init()
	{
		$element = $this->getElement();
		$column = $this->getColumn();
		
		$values = $column->getFKValues();
		if ($column->isNull()) {
			$element->addMultiOption(null);
		}
		
		$element->addMultiOptions($values);
	}
	
	/**
	 * Return element class name by column type.
	 * Try to get class from config or automatic from column type.
	 * 
	 * @return string
	 */
	protected function _getElementClass()
	{
		return 'Zend_Form_Element_Select';
	}
}